import request from '@/utils/request'

// 获取分类
export const getCategoryListings = (_limit, _start, title_contains) => request({
  url: '/categories',
  method: 'get',
  params: {
    _limit,
    _start,
    title_contains
  }
})

// 新增分类
export const addClassify = data => request({
  url: '/categories',
  data,
  method: 'post'
})

// 删除分类
export const delClassify = id => request({
  url: '/categories/' + id,
  method: 'DELETE'
})

// 编辑分类
export const updateClassify = id => request({
  url: '/categories/' + id,
  method: 'put'
})

// 查找分类
export const findClassify = (title_contains) => request({
  url: '/categories',
  params: {
    title_contains
  },
  method: 'get'
})

// 获取分类数量
export const quanClassify = (title_contains) => request({
  url: '/categories/count',
  method: 'get',
  params: {
    title_contains
  }
})
